package com.tianqu.tms.core.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 * @author liugang
 *
 */
public class UserContextImpl extends UserContext {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private transient HttpServletRequest request = null;
	private transient HttpServletResponse response = null;

	/**
	 * 
	 */
	public UserContextImpl() {
	}

	/**
	 * 
	 * @param requestHttp
	 * @param responseHttp
	 */
	public void setServletParams(
		HttpServletRequest requestHttp,
		HttpServletResponse responseHttp) {
		this.request = requestHttp;
		this.response = responseHttp;
	}

	/**
	 * 
	 * @return
	 */
	public HttpServletRequest getHttpServletRequest() {
		return request;
	}

	/**
	 * 
	 * @return
	 */
	public HttpServletResponse getHttpServletResponse() {
		return response;
	}

	/**
	 * 
	 * @return
	 */
	public boolean isNewSession() {
		return request.getSession(false).isNew();
	}

	/**
	 * 
	 */
	public String getParameter(String paramName) {
		return request.getParameter(paramName);
	}

	/**
	 * 
	 */
	public void setRequestAttribute(String name, Object value) {
		request.setAttribute(name, value);
	}

	/**
	 * 
	 */
	public Object getRequestAttribute(String name) {
		return request.getAttribute(name);
	}

	/**
	 * 
	 */
	public String[] getParameterValues(String paramName) {
		return request.getParameterValues(paramName);
	}
}